<?
session_start();
if(!session_is_registered("myusername")){
    header("location:index.php");
}
else{
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
        <title>Kartapuce - Projet BDD FPMs >> Aide</title>
        <link rel="stylesheet" href="./mystyle.css" type="text/css" media="screen" />
    </head>
    <body>
        <small>
            <b>Logged as:
                <?
                session_start();
                print $myusername;
                ?>
                <A HREF="./logout.php">Log out</A>

            </b>
        </small>

        <div id="conteneur" align="center" class="conteneur">
            <div align="center" class="conteneurdessus">
                <img src="img/banner.png" width="600" height="185" alt="banner" border="0"/>
            </div>
        </div>
        <center>
            <div id="conteneurdessus" align="center" class="conteneurdessus">
                <table border="0" cellspacing="10">
                    <td>
                        <A HREF="./boutique.php"><img src="img/boutique.png" width="138" height="39" alt="boutique" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./compte.php"><img src="img/compte.png" width="138" height="39" alt="compte" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./commandes.php"><img src="img/commandes.png" width="138" height="39" alt="commandes" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./panier.php"><img src="img/panier.png" width="138" height="39" alt="panier" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./accueil.php"><img src="img/accueil.png" width="138" height="39" alt="accueil" border="0"/>
                        </A>
                    </td>
                </table>

            </div>



            <div id='colonne1' align='left' class='colonnem'>
            <?
            include 'connect_db.php';

            $cmd=$_GET['order'];

            $sql0="SELECT db_cmdcl.date_commande as 'date' FROM db_cmdcl INNER JOIN db_clients ON db_clients.email=db_cmdcl.clients_email WHERE email='".$myusername."' AND db_cmdcl.idcmdcl='".$cmd."'";
            $result0=mysql_query($sql0);
            $row0 = mysql_fetch_row($result0);

            echo '<br><dd><font face="New Century" size="5" color="black">&nbsp<u><b>Détails de la commande n° <i>'.$cmd.'</i></b><br></u></font> ';
            echo '<br><b>Identifiant client: </b><i>';
            echo $myusername;
            echo '</i><b><br>Date de commande: </b><i>';
            echo $row0[0];
            echo '</i><br>';
            $sql="SELECT db_cmdcl.cartes_idcarte as 'id', db_cmdcl.etat as 'etat', db_cmdcl.date_commande as 'date', db_cmdcl.quantite as 'qty', db_cmdcl.prix_unitaire as 'pu' FROM db_cmdcl INNER JOIN db_clients ON db_clients.email=db_cmdcl.clients_email WHERE email='".$myusername."' AND db_cmdcl.idcmdcl='".$cmd."'";
            $result=mysql_query($sql);
       
            echo '<br><TABLE BORDER=1>';
            echo '<TR><TD><b>ID carte</b></TD><TD><b>Quantité</b></TD><TD><b>Prix unitaire</b></TD><TD><b>Sous total</b></TD><TD><b>Etat</b></TD></TR>';
            while($tableau=mysql_fetch_array($result,MYSQL_ASSOC))
            {
                echo '<TR><TD>',$tableau['id'],'</TD><TD>',$tableau['qty'],'</TD><TD>',$tableau['pu'],' EUR</TD><TD>',$tableau['pu']*$tableau['qty'],' EUR</TD><TD>',$tableau['etat'],'</TD><TD><input type="button" value="Détails carte" OnClick=window.open("details_cartes.php?id='.$tableau['id'].'")></TD></TR>';

            }



            echo '</TABLE>';
          
            echo "</form>";

            echo '<br></dd>';


            echo '<dd><form><input type="button" value="Retour" OnClick=window.location.replace("commandes.php")></dd><br>';

            mysql_close($link);
            ?>
            </div>
        </center>
    </body>
</html>